package cn.gjculture.shopping.api.dao;

import cn.gjculture.shopping.api.entity.Hotel;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface HotelDao {

    @Insert("insert into hotel(hotelId,hotelName,hotelIntroduction,hotelDesc,insertTime,updateTime,status,belongArea,hotelAddress,hotelPhone,tags,recommended,thumb) " +
            "values(#{hotelId},#{hotelName},#{hotelIntroduction},#{hotelDesc},#{insertTime},#{updateTime},#{status},#{belongArea}," +
            "#{hotelAddress},#{hotelPhone},#{tags},#{recommended},#{thumb})")
    int insert(Hotel hotel);

    @Select("select * from hotel")
    List<Hotel> query();

    @Select("select * from hotel where hotelId=#{hotelId}")
    Hotel queryById(String hotelId);

    @Delete("delete from hotel where hotelId=#{hotelId}")
    int delete(String hotelId);

    @Update("update hotel set recommended=#{recommended} where #{hotelId}")
    int recommended(Hotel hotel);

    @Select("select * from hotel where recommended=0")
    List<Hotel> queryRecommended();

}
